#!/bin/bash
#Image_ids=($(sudo docker images | awk '{if(NR>1){print $3}}'))
#Images_save=`sudo docker images --format "{{.Repository}}-{{.Tag}}"`
#Image_ids=$(sudo docker images --format "{{.ID}}")

Image_tags=($(sudo docker images --format "{{.Repository}}:{{.Tag}}"))
Image_names=($(sudo docker images --format "{{.Repository}}-{{.Tag}}"|sed 's/\//-/g'))

for i in ${!Image_tags[@]};do
  sudo docker save -o /home/ljianing/dockerimages/${Image_names[$i]}.tar.gz ${Image_tags[$i]}
done
